﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.OleDb;
using System.Data.Common;

namespace DataAccess
{
    /// <summary>
    /// CommentAccess 的摘要说明。
    /// </summary>
    public class CommentAccess : BaseAccess
    {
        public CommentAccess(DBManager objDBManager)
            : base(objDBManager)
        {
            this.m_TableName = "Comment";
            this.m_PKName = "intCommentID";
        }
        public int QueryByWS_ID(ref DataSet obj_Ds, int WS_ID)
        {
            OleDbCommand obj_Command = new OleDbCommand(m_SelectSql + " WHERE intWSID=" + WS_ID.ToString());
            try
            {
                obj_Command.Connection = CurrentlyConnection;
                if (this.CurrentlyTransaction != null)
                {
                    obj_Command.Transaction = CurrentlyTransaction;
                }

                OleDbDataAdapter obj_OleDbDataAdapter = new OleDbDataAdapter();
                try
                {
                    obj_OleDbDataAdapter.SelectCommand = obj_Command;
                    return obj_OleDbDataAdapter.Fill(obj_Ds, m_TableName);
                }
                finally
                {
                    obj_OleDbDataAdapter.Dispose();
                }

            }
            finally
            {
                obj_Command.Dispose();
            }
        }
    }
}
